package com.bc;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.Vector;

import com.bc.custom.UserInfo;

import android.content.SharedPreferences;

public class BCClient {
	
	Socket bcSocket = null;
    PrintWriter out = null;
    BufferedReader in = null;
	private boolean sharing = false;
	private String key;
	private String location;
	private boolean creating;
	
	public BCClient(){
		location = "Loc Disabled";
	}
	
	public void connect() throws Exception{
		
		
		//CONNECT
		/*
		try {
            bcSocket = new Socket("10.0.2.2", 4444);
            out = new PrintWriter(bcSocket.getOutputStream(), true);
            in = new BufferedReader(new InputStreamReader(bcSocket.getInputStream()));
        } catch (UnknownHostException e) {
            System.err.println("Don't know about host: localhost.");
            throw(e);
        } catch (IOException e) {
            System.err.println("Couldn't get I/O for the connection to: localhost.");
            throw(e);
        }
		*/
		System.out.println("connected");
		
	}
	
	
	public void sendCard(File f){
		
	}
	
	
	/**
	 * @param user the user requesting info
	 * @param k the lobby key
	 * @return
	 */
	public Vector<UserInfo> getLobbyUsersInfo(){
		
		
		return null;
	}
	
	
	
	
	
	public Socket getBcSocket() {
		return bcSocket;
	}

	public PrintWriter getOut() {
		return out;
	}

	public BufferedReader getIn() {
		return in;
	}

	public String getKey() {
		return key;
	}
	
	public String getLocation() {
		return location;
	}

	public boolean isCreating() {
		return creating;
	}

	public void shutdown() throws IOException{
		
		out.close();
        in.close();
        bcSocket.close();
		
	}

	public void enableSharing() {
		sharing = true;
		
	}

	public boolean isSharing() {
		// TODO Auto-generated method stub
		return sharing ;
	}

	public void disableSharing() {
		//DO SOMTHIN
		sharing = false;
	}

	public void setKey(String key) {
		this.key = key;
	}
	
	public void setLocation(String location) {
		this.location = location;
	}

	public void setCreating(boolean b) {
		creating = b;
	}
}
